package Java攻略._5_流式操作_lambda表达式与方法_引用的相关问题._1_java_util_Objects类;

import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

public class _2_筛选器测试 {

    public static void main(String[] args) {

        List<String> stringList = Arrays.asList("this", null, "is", null, "a", null, "list");

        List<String> collect = stringList.stream()
                .filter(Objects::nonNull)
                .collect(Collectors.toList());

        List<String> nonNullStrings = Arrays.asList("this", "is", "a", "list");
        System.out.println("两个数组是否相等：" + Objects.deepEquals(collect,nonNullStrings));
    }
}
